#ifndef ODN_LOGMGR_H
#define ODN_LOGMGR_H

#include <ostream>

#include "ODN_DLLAccess.h"
#include "ODN_String.h"
#include "ODN_Singleton.h"

#define ODN_LOGGING_THRESHOLD 4

//This is for easier access to the ouden log function
#define ODN_LOG(x) ouden::CLogMgr::getInstance()->log(x)

namespace ouden {

typedef std::ostream OutStream;

enum LogMessageLevel { 	LML_DEBUG=1, 
						LML_NORMAL=2,
						LML_WARNING=3,
						LML_ERROR=4 };
						
enum LoggingLevel { LL_ERROR_ONLY=1,
					LL_LOW=2,
					LL_NORMAL=3,
					LL_DEBUG=4 };

class ODN_DLLACCESS CLogMgr : public CSingleton<CLogMgr>
{
public:
	CLogMgr();
	virtual ~CLogMgr();
	
	void setLoggingLevel(LoggingLevel iLoggingLevel) 		{ m_iLoggingLevel = iLoggingLevel; }
	void setLogStream(OutStream* pLogStream) 		{ assert(pLogStream); m_pLogStream = pLogStream; }
	
	OutStream& log(LogMessageLevel iLevel = LML_NORMAL);
	
protected:
private:
	
	OutStream* m_pLogStream;
	StringStream m_NullStream;
	LoggingLevel m_iLoggingLevel;
	
};

} //namespace ouden

#endif // ODN_LOGMGR_H
